home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / WORD_R&L.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  63 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   WORD_R&L.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB01.INC"
  22. COLOR 7,0
  23. CLS
  24.  
  25. ? "┌───────────────────────────────────────────────────────────────────────────
  26. ? "│ fWordRight% ( MidPos%, V$ )
  27. ? "│ fWordLeft%  ( MidPos%, V$ )
  28. ? "├───────────────────────────────────────────────────────────────────────────
  29. ? "│ fWordRight% returns the MID$ position of the word to the right of MidPos%
  30. ? "│ fWordLeft%  returns the MID$ position of the word to the left  of MidPos%
  31. ? "│
  32. ? "│ BOTH        return ZERO if no further words are found
  33. ? "│             adjust MidPos% to 1 or LEN(V$) if it is ZERO
  34. ? "│
  35. ? "│ These routines are really handy in editors!
  36. ? "└───────────────────────────────────────────────────────────────────────────
  37. ?
  38.  
  39. A$ = " We are testing fWordRight% "
  40. PRINT CHR$(34); A$; CHR$(34)
  41.  
  42. DO
  43.   M% = fWordRight%( M%, A$ )
  44.   IF M% = 0 THEN EXIT LOOP
  45.   INCR X%, 1
  46.   LOCATE 15, M% +1 : PRINT CHR$(24)
  47.   LOCATE 16, M% +1 : PRINT USING "#"; X%
  48. LOOP
  49.  
  50. M% = 0
  51. X% = 0
  52. A$ = " We are testing fWordLeft%  "
  53. PRINT
  54. PRINT CHR$(34); A$; CHR$(34)
  55.  
  56. DO
  57.   M% = fWordLeft%( M%, A$ )
  58.   IF M% = 0 THEN EXIT LOOP
  59.   INCR X%, 1
  60.   LOCATE 19, M% +1 : PRINT CHR$(24)
  61.   LOCATE 20, M% +1 : PRINT USING "#"; X%
  62. LOOP
  63.